<template>
	<view class="page">
		<view class="top" v-if="show">
		</view>
		<view class="content">
			<view class="title">忘记密码</view>
			<view class="tip">请输入您的注册手机号</view>
			<view class="inputBox">
				<view class="phonetip">手机号码</view>
				<view class="phone">
					<view class="left"><view class="text">+86</view><image src="../../static/icon/phoneDown.png"></image></view>
					<input class="right" v-model="phone" placeholder="请输入手机号"/>
				</view>
			</view>
			<button :loading="loading" :disabled="loading" class="btn" @tap="toCode">发送验证码</button>
		</view>
	</view>
</template>

<script>
	import {sendCode} from '../../api/login/index'
	export default{
		data() {
			return {
				show:false,
				loading:false,
				phone:'',
			}
		},
		onLoad() {
			// #ifdef H5
			this.show = true
			// #endif
		},
		methods:{
			toCode(){
				if(this.phone == ''){
					this.$tools.toast("请输入手机号")
					return
				}
				if(this.phone.length != 11){
					this.$tools.toast("请输入正确的手机号")
					return
				}
				this.loading = true
				sendCode({phone:this.phone}).then(res=>{
					this.loading = false
					uni.navigateTo({
						url:"./code?phone="+this.phone+"&type=1"
					})
				}).catch(err =>{
					this.loading = false
				})
			},
			toBack(){
				uni.navigateBack({
					delta:2
				})
			},
			backLogin(){
				uni.navigateBack({
					delta:1
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.page {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background: #FFFFFF;
		z-index: 99;
	}

	.top {
		height: 44px;
	}

	.content {
		margin-top: 100rpx;
		padding: 0 60rpx;
		.title {
				font-size: 40rpx;
				font-weight: 700;
		}

		.tip {
			margin-top: 30rpx;
			font-size: 30rpx;
		}
		input{
			font-size: 27rpx!important;
		}
		.inputBox{
			margin-top: 80rpx;
			.phonetip{
				font-size: 21rpx;
				color: #808080;
			}
			.phone{
				display: flex;
				justify-content: left;
				align-items: center;
				padding: 30rpx 0;
				border-bottom: 0.5px solid $uni-border-color;
				.left{
				    flex: none;
					display: flex;
					justify-content: left;
					align-items: center;
					padding-left: 8rpx;
					padding-right: 10rpx;
					border-right: 0.5px solid $uni-border-color;
					margin-right: 30rpx;
					.text{
						font-size: 28rpx;
						align-self: center;
						line-height: 30rpx;
					}
					image{
						width: 22rpx;
						height: 22rpx;
						align-self: center;
						margin: 0 10rpx;
					}
				}
				.right{
					flex: auto;
					padding: 5rpx;
				}
				
			}
			}
			   .btn{
				   background: $uni-bg-color;
				   height: 90rpx;
				   line-height: 90rpx;
				   color: #FFFFFF;
				   margin-top: 60rpx;
			   }
	}
</style>
